package com.material.vtool.service.impl;

import com.material.vtool.entity.BTeamMaterialMessageEntity;
import com.material.vtool.entity.respEntity.ReturnCode;
import com.material.vtool.exception.ServiceException;
import com.material.vtool.mapper.TeamMaterialMessageMapper;
import com.material.vtool.service.TeamMaterialMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeamMaterialMessageServiceImpl implements TeamMaterialMessageService {
    @Autowired
    private TeamMaterialMessageMapper teamMaterialMessageMapper;

    @Override
    public int save(BTeamMaterialMessageEntity entity) {
        int affectedCount = teamMaterialMessageMapper.insertEntity(entity);
        if (affectedCount == 0) throw new ServiceException("保存失败", ReturnCode.SERVER_ERROR);
        return affectedCount;
    }
}
